//package com.codebattery.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//
//import io.seata.rm.datasource.DataSourceProxy;
//import org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//
//import javax.sql.DataSource;
//import java.sql.SQLException;
//
//@Configuration
//public class DataSourceConfig {
//
//    @Bean
//    @ConfigurationProperties(prefix = "spring.shardingsphere.datasource")
//    public ShardingDataSource shardingDataSource() throws SQLException {
//        return new ShardingDataSource();
//    }
//
//    /**
//     * 需要将 DataSourceProxy 设置为主数据源，否则事务无法回滚
//     *
//     * @param druidDataSource The DruidDataSource
//     * @return The default datasource
//     */
//    @Primary
//    @Bean("dataSource")
//    public DataSource dataSource(ShardingDataSource shardingDataSource) {
////        return new DataSourceProxy(druidDataSource);
//
//        return null;
//    }
//}